TANK_OB = class("TANK_OB")
TANK_OB:inherit(F_COMN_DBASE)
TANK_OB:inherit(F_COMN_ID)

---! 拥有者Id
function TANK_OB:get_owner_id()
    return self:query_temp("owner_id")
end

function TANK_OB:set_owner_id(owner_id)
    return self:set_temp("owner_id", owner_id)
end

---! 血量
function TANK_OB:get_hp()
    return self:query_temp("hp")
end

function TANK_OB:set_hp(hp)
    return self:set_temp("hp", hp)
end

function TANK_OB:cost_hp(hp)
    return self:set_temp("hp", math.max(0, self:get_hp() - hp))
end

---! 位置
function TANK_OB:get_position()
    return self:query_temp("position")
end

function TANK_OB:set_position(pos)
    return self:set_temp("position", pos)
end

---! 阵营
function TANK_OB:get_camp(camp)
    return self:query_temp("camp")
end

function TANK_OB:set_camp(camp)
    return self:set_temp("camp", camp)
end

---! 击毁坦克数量
function TANK_OB:get_tank_num()
    return self:query_temp("tank_num") or 0
end

function TANK_OB:add_tank_num(num)
    return self:set_temp("tank_num", self:get_tank_num() + (num or 1))
end

---! 死亡时间
function TANK_OB:get_dead_time()
    return self:query_temp("dead_time") or os.time()
end

function TANK_OB:set_dead_time(ti)
    return self:set_temp("dead_time", ti)
end

---! 属性
function TANK_OB:get_max_hp()
    return TANK_D:get_max_hp(self)
end

function TANK_OB:get_attack()
    return TANK_D:get_attack(self)
end

function TANK_OB:is_alive()
    return self:get_hp() > 0 and 1 or 0
end

function TANK_OB:is_dead()
    return self:get_hp() <= 0
end

---!
function TANK_OB:get_combat_data()
    return TANK_D:build_combat_data(self)
end
